<h1>Events</h1>

<%= link_to_remote 'Create New Event', {:url => new_event_path, :update => "new_event"}, {:class => "create add"} %>
<br />
<div id="new_event">
</div>

<table class="index">
  <tr>
    <th>Name</th>
    <th>Start</th>
    <th>Finish</th>
    <th>Personnel Requirements</th>
    <th>Actions</th>
  </tr>

  <% @events.each do |event| %>
    <tr>
      <td><%=h event.name %></td>
      <td>
        <%=h event.starts_at.strftime("%b %d, %y") %> <br />
        <%=h event.starts_at.strftime("%I:%M%p") %>
      </td>
      <td>
        <%=h event.ends_at.strftime("%b %d, %y") %> <br />
        <%=h event.ends_at.strftime("%I:%M%p") %>
      </td>
      <td>
        <%= "#{event.volunteers_req}" << image_tag("/images/icons/roles/16-volunteer.png", :title => "This event requires #{event.volunteers_req} volunteers", :class => "icon") << "  #{event.keyholders_req}" << image_tag("/images/icons/roles/16-keyholder.png", :title => "This event requires #{event.keyholders_req} keyholders", :class => "icon")  << "  #{event.volunteers_req}" << image_tag("/images/icons/roles/16-boardmember.png", :title => "This event requires #{event.boardmembers_req} boardmembers", :class => "icon")  %>
        Satisfied:
        <% if event.has_required_volunteers && event.has_required_boardmembers && event.has_required_keyholders %>
          <%= image_tag("/images/icons/png-8/16-em-check.png", :title => "People requirements met", :class => "icon") %>
        <% else %>
          <%=  image_tag("/images/icons/png-8/16-message-warn.png", :title => "People requirements not met", :class => "icon") %>
        <% end %>
      </td>
      <td><%= link_to image_tag("/images/icons/png-8/16-file-page.png", :alt => "Show", :title => "Show #{event.name}", :class => "icon"), event %> <%= link_to image_tag("/images/icons/png-8/16-tool-b.png", :alt => "Edit", :title => "Edit #{event.name}", :class => "icon"), edit_event_path(event) %> <%= link_to(image_tag("/images/icons/png-8/16-em-cross.png", :alt => "Remove", :title => "Remove #{event.name}", :class => "icon"), event, :confirm => "Are you sure you want to remove this event (#{event.name})?", :method => :delete) unless event.visitors.size > 0 %></td>
    </tr>
  <% end %>
</table>

<br />

